<?php
include'../Classes/attemployeeHandler.php';
include'../Classes/db.php';

$x=new DbConnect();
$con=$x->getConnection();

$empno=$_GET['empno'];
$date=$_GET['date'];
$in=$_GET['in'];
$out=$_GET['out'];

$month=substr($date,3,2);
$year=substr($date,6,4);
$day1=substr($date,0,2);
$day=$year."-".$month."-".$day1;//arrange date in format

$att=new AttEmployeeHandler();//create a new object
$att->setConnect($con);
$att->setEmpno($empno);

$time_now=mktime(date('H')+5,date('i')+30,date('s'),date('m'),date('d'),date('Y'));

 	$yearnw=date('Y',$time_now); 
 	$monthnw=date('m',$time_now); 
 	$datenw=date('d',$time_now);

	if (($year < $yearnw) || (($year == $yearnw)&&($month < $monthnw)) || (($year == $yearnw)&&($month = $monthnw)&&($day1 <= $datenw)))
			{
			$result=$att->attAdd($day,$in,$out);
			echo $result;			
			}
	else
			{
			echo "Future Date !";
			}
			
?>